/* Message List */
// a.k.a. notifications in the menu

// main list
.message-list {
  width: 29em;
  color: $text-secondary;
  border: solid transparent;

  // padding and margins to account for scrollbar
  &:ltr { margin-left: 0; margin-right: 0; padding-right: 0; border-right-width: 0; }
  &:rtl { margin-right: 0; margin-left: 0; padding-left: 0; border-left-width: 0; }

  .message-list-placeholder {
    @extend %title_2;
    color: $text-secondary-disabled;

    // icon size and color
    > StIcon {
      icon-size: 96px; // 48px
      margin-bottom: $margin-size * 3;
      -st-icon-style: symbolic;
    }
  }
}

.message-list-sections {
  spacing: $space-size;

  // to account for scrollbar
  &:ltr { margin-right: $margin-size; padding-left: $space-size; }
  &:rtl { margin-left: $margin-size; padding-right: $space-size; }
}

.message-list-section,
.message-list-section-list {
  spacing: $space-size;
}

// do-not-disturb + clear button
.message-list-controls {
  margin: ($margin-size * 2) ($margin-size * 4) 0;
  // NOTE: remove the padding if notification_bubble could remove margin for drop shadow
  padding: $margin-size;
  spacing: $space-size * 2;
  @extend %heading;

  .dnd-button {
    // We need this because the focus outline isn't inset like for the buttons
    // so the dnd button would grow when it gets focus if we didn't change only
    // its color when focusing.
    border-width: 2px;
    border-color: transparent;
    border-radius: 32px;
    border-style: solid;

    &:focus {
      border-color: transparentize($primary, 0.4);
    }
  }
}

// message bubbles
.message {
  border-radius: $material-radius;
  padding: $space-size;
  margin: 0;
  // border-width: 0; // can not set this ?

  .popup-menu & {
    @extend .events-button;
    box-shadow: none;
    padding: $space-size;
    margin: $margin-size;
    color: $text-secondary;
  }

  // subtract side padding to accommodate the close button's border
  &:ltr { padding-right: $space-size; }
  &:rtl { padding-left: $space-size; }

  // message header
  .message-header {
    padding: 0 $space-size;
    spacing: $space-size;
    color: $text-disabled;

    &:ltr { padding-right: 0; }
    &:rtl { padding-left: 0; }

    // header source icon
    .message-source-icon {
      icon-size: $scalable-icon-size; // 16px
      -st-icon-style: symbolic;
    }

    // box that contains the source icon, source name and timestamp of the message
    .message-header-content {
      spacing: $space-size;
      min-height: to_em(24px);
      padding-bottom: $space-size;

      // header source title
      .message-source-title {
        font-weight: bold;
      }

      // Time label
      .event-time {
        @extend %caption;
        color: $text-disabled;
        // Add bottom padding to align the app name with the time horizontally
        padding-bottom: to_em(1px);

        &:ltr { text-align: right; }
        &:rtl { text-align: left; }
      }
    }

    // buttons in the message header
    .message-expand-button,
    .message-close-button {
      @extend .icon-button;
      color: $text;
      background-color: $fill;
      padding: $margin-size;

      &:hover { background-color: $divider; }
      &:active,
      &:active:hover { background-color: $track; }
      &:insensitive { background-color: transparent; }
    }

    .message-expand-button {
      padding: $margin-size;

      &:ltr { margin-right: $space-size; }
      &:rtl { margin-left: $space-size; }
    }
  }

  // container for message contents
  .message-box {
    padding: $space-size;
    margin: $space-size;
    margin-top: 0;
    spacing: $space-size;

    // icon of the message
    .message-icon {
      &:ltr { margin-right: $space-size; }
      &:rtl { margin-left: $space-size; }

      // icon size and color
      icon-size: $base-icon-size * 3; // 48px
      -st-icon-style: symbolic;

      &.message-themed-icon {
        border-radius: $circular-radius; // is circular
        background-color: $divider;
        icon-size: $base-icon-size;
        min-width: $base-icon-size * 3;
        min-height: $base-icon-size * 3;
      }
    }

    // If the header isn't displayed we need more top margin
    &:first-child {
      margin-top: $space-size * 2;
    }

    // text of the message
    .message-content {
      spacing: $margin-size;

      // message title
      .message-title {
        font-weight: bold;
      }
    }
  }
}

// URLs in messages
.url-highlighter {
  link-color: $link;
}

/* Media Controls */
.message-media-control {
  margin: (16px - $space-size * 2) $space-size / 2 !important;
  padding: 0 $space-size * 2 !important;
  border-radius: $circular-radius;
  color: $text-secondary;
  border: none;

  &:hover, &:focus { color: $text; background-color: $secondary-fill; }
  &:active { color: $text; background-color: $track; }
  &:insensitive { color: $text-secondary-disabled; }

  & StIcon { icon-size: $base-icon-size; }
}

.media-message {
  // album-art
  .message-icon {
    border-radius: $corner-radius / 2 !important;

    &.message-themed-icon {
      icon-size: $large-icon-size !important; // 32px
    }
  }
}
